package homework;

import java.util.Scanner;

/**
 * @classname:demo10
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/8 17:38
 * @version: 0.1
 * @since:1.8
 */
public class demo10 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("共" + judea(input) + "个a");
    }

    private static int judea(Scanner input) {
        StringBuilder sb = new StringBuilder();
        while (true) {
            System.out.println("请输入两个字母");
            String a = input.next();
            sb.append(a);
            if (sb.length() == 6) {
                break;
            }
        }
        String s = sb.toString();

        int count = 0;
        for (int i = 0; i < s.length(); i++) {
            char charAt = s.charAt(i);
            if (charAt == 'a') {
                count++;
            }
        }
        return count;
    }
}
